package com.easybbs.utils;

import com.easybbs.entity.enums.VerifyRegexEnum;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 校验参数使用哪些方法的工具类
 */
public class VerifyUtils {
    public static boolean verify(String regs,String value) {
        if(StringTools.isEmpty(value)){
            return false;
        }
        Pattern pattern = Pattern.compile(regs);
        Matcher matcher = pattern.matcher(value);
        return matcher.matches();
    }
    public static boolean verify(VerifyRegexEnum regs, String value){
        return verify(regs.getRegex(),value);
    }
}
